<?php

namespace App\Service\UserCenter;

use App\Model\UserProfilePersonal;
use App\Service\BaseService;

/**
 * 绑定提现账号
 */
class WithdrawBindService extends BaseService
{
    protected function RoVerifyList()
    {
        return [
            'id_card_pics' => 'required|string',
            'real_name' => 'required|string',
            'id_card' => 'required|string',
            'phone' => 'required|string',
            'alipay_account' => 'required|string',
        ];
    }

    public function handle()
    {
        $userId = $this->getUserId();
        $info['real_name'] = $this->request->input('real_name', '');
        $info['id_card'] = $this->request->input('id_card', '');
        $info['alipay_account'] = $this->request->input('alipay_account', '');
        $info['phone'] = $this->request->input('phone', '');
        $info['id_card_pics'] = $this->request->input('id_card_pics', '');
        if ($info['id_card_pics']) {
            $info['id_card_pics'] = json_encode(explode(',', $info['id_card_pics']));
        }
        //更新私人资料
        UserProfilePersonal::updateInfo($userId, $info);
        $ret = ['result' => 1];
        // log_user_result($userId, $ret);
        return $ret;
    }
}
